package testing;

import static org.junit.Assert.*;

import org.junit.Test;

import clases.Digrafo;
import clases.Dijkstra;

public class DijkstraTest
{
	@Test
	public void cincoNodos()
	{
		Digrafo digrafo = new Digrafo(5);
		digrafo.setArco(0, 1, 4.0);
		digrafo.setArco(0, 3, 5.0);
		digrafo.setArco(1, 2, 3.0);
		digrafo.setArco(2, 4, 1.0);
		digrafo.setArco(3, 2, 1.0);
		digrafo.setArco(3, 4, 1.0);
		
		assertEquals(6, Dijkstra.dijkstra(digrafo, 0, 4),0.0001);
		assertEquals(4, Dijkstra.dijkstra(digrafo, 1, 4),0.0001);
		assertEquals(6, Dijkstra.dijkstra(digrafo, 0, 2),0.0001);
		assertEquals(Double.MAX_VALUE, Dijkstra.dijkstra(digrafo, 4, 0),0.0001);
	}
}
